package UIFree.controls
{
	import UIFree.uif_component;
	import UIFree.uif_ecomponent;
	
	import flash.geom.Rectangle;

	public class uif_tabsBox extends uif_ecomponent {
		private var _tabs: uif_tabs;
		private var _tabLayer: uif_tabsLayer;
		
		public static var layerClass: Class = uif_tabsLayer;
		public static var tabsClass: Class = uif_tabs;
		
		public function uif_tabsBox(parent:uif_component, ax:int=0, ay:int=0, 
									awidth:int=0, aheight:int=0, 
									atabwidth:int=0, styleClass:String='') {
			super(parent, ax, ay, awidth, aheight, styleClass);
			var tbox: Rectangle = getInner();
			tbox.height = style['tab_height']?style['tab_height']:25;
			if (atabwidth) tbox.width = atabwidth;
			
			initTabs(tbox, style['tab_class']);
			
			var tinner: Rectangle = getInner();
			_tabLayer = new layerClass(this, tinner.x, tinner.y + tbox.height, 
										tinner.width, tinner.height - tbox.height, style['layer_class']);
		}
		
		protected function initTabs(rect: Rectangle, tabStyle: String): void {
			_tabs = new tabsClass(this, rect.x, rect.y, rect.width, rect.height, tabStyle);
		}
		
		public function get tabs(): uif_tabs {
			return _tabs;
		}
		
		public function get layer(): uif_tabsLayer {
			return _tabLayer;
		} 
		
		protected function getItemTitle(item: Object): String {
			return item as String;
		}
	}
}